package com.jh3502.helper.function.batch.mytask;

import android.content.Context;

import com.google.gson.Gson;
import com.jh3502.helper.base.BaseJson;
import com.jh3502.helper.base.BaseModel;
import com.jh3502.helper.net.ApiClient;

import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.Callback;

/**
 * @author harisucici
 */

public class MyTaskModel extends BaseModel {

    public MyTaskModel(Context context) {
        super(context);
    }

    //人员列表
    public void getoneall(String batno, Callback<BaseJson> callback) {
        mCall = ApiClient.apiList.getoneall(batno);
        mCall.enqueue(callback);
    }

    //量体任务列表
    public void listall(String username, Callback<BaseJson> callback) {
        mCall = ApiClient.apiList.listall(username);
        mCall.enqueue(callback);
    }

    //保存数据
    public void saveoneall(Map<String, Object> body, Callback<BaseJson> callback) {
        mCall = ApiClient.apiList.saveoneall(
                RequestBody.create(okhttp3.MediaType.parse("application/json;charset=UTF-8"), new Gson().toJson(body)));
        mCall.enqueue(callback);
    }
}
